package com.qingzhi.spring.demo.mapper;

import com.qingzhi.spring.demo.model.MessageInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageInfoMapper {

    // 添加输入的信息
    @Insert("insert into message_info (`from`,`to`,`message`) values (#{from},#{to},#{message})")
    Integer insertMessage(MessageInfo messageInfo);

    // 查询所有信息
    @Select("select `id`,`from`,`to`,`message` from message_info where delete_flag = 0")
    List<MessageInfo> queryAll();
}
